@layout("/common/_curd/_container.html"){

<script type="text/javascript">
	var ctx = "${basePath}";
	var grid_selector = "#grid-table";
	var pager_selector = "#grid-pager";
	
	$(function(){
		initGrid();
		initMenuBtn("btns", "${code}");
	});
	
	function initGrid(){
		var grid_url = ctx + "/${code}/list";
		var _colnames = ["ID",
						"电站编号", 
						"水位类型编号", 
						"水位类型名称", 
						"创建人", 
						"创建时间", 
						"是否在用 ", 
						"水位上线预警", 
						"水位下线预警", 
						"水位上线报警", 
						"水位下线报警", 
						"水位单位", 
						"流量预警", 
						"流量报警", 
						"流量单位", 
						"数据上传方式", 
						"上传数据分类", 
						"开始时间", 
						"结束时间", 
						"上传数据时间类型", 
						"上传时间值"];
		var _colmodel = [{name:"id", index:"id", width:30},
						{name:"number", index:"number", width:100},
						{name:"serialNumber", index:"serialNumber", width:100},
						{name:"name", index:"name", width:100},
						{name:"createAc", index:"createAc", width:100},
						{name:"createAt", index:"createAt", width:150},
						{name:"state", index:"state", width:100, editoptions:{value:"1:在用;2:停止;"},
							formatter:function(cellvalue, options, rowObject){
								if(rowObject.state == 0){
									return "<div style='color:green;'>在用</div>";
								}else if(rowObject.state == 1){
									return "<div style='color:red;'>停止</div>";
								}else{
									return "状态错误！"
								}
							}
						},
						{name:"upperWarn", index:"upperWarn", width:100},
						{name:"lowerWarn", index:"lowerWarn", width:100},
						{name:"upperAlarm", index:"upperAlarm", width:100},
						{name:"lowerAlarm", index:"lowerAlarm", width:100},
						{name:"unitLevel", index:"unitLevel", width:100},
						{name:"flowWarn", index:"flowWarn", width:100},
						{name:"flowAlarm", index:"flowAlarm", width:100},
						{name:"unitFlow", index:"unitFlow", width:100},
						{name:"status", index:"status", width:50, editoptions:{value:"0:自动;1:手动;"},
							formatter:function(cellvalue, options, rowObject){
								if(rowObject.status == 0){
									return "<div style='color:green;'>自动</div>";
								}else if(rowObject.status == 1){
									return "<div style='color:Salmon;'>手动</div>";
								}else{
									return "状态错误！"
								}
							}
						},
						{name:"type", index:"type", width:100,editoptions:{value:"0:全部;1:水位;2:流量;"},
							formatter:function(cellvalue, options, rowObject){
								if(rowObject.type == 0){
									return "<div style='color:red;'>全部</div>";
								}else if(rowObject.type == 1){
									return "<div style='color:MediumTurquoise;'>水位</div>";
								}else if(rowObject.type == 2){
									return "<div style='color:RosyBrown;'>流量</div>";
								}else{
									return "状态错误！"
								}
							}
						},
						{name:"beginTime", index:"beginTime", width:100},
						{name:"endTime", index:"endTime", width:100},
						{name:"timeType", index:"timeType", width:100,editoptions:{value:"0:秒;1:分;2:时;3:天"},
							formatter:function(cellvalue, options, rowObject){
								if(rowObject.timeType == 0){
									return "<div style='color:red;'>秒</div>";
								}else if(rowObject.timeType == 1){
									return "<div style='color:MediumTurquoise;'>分</div>";
								}else if(rowObject.timeType == 2){
									return "<div style='color:RosyBrown;'>时</div>";
								}else if(rowObject.timeType == 3){
									return "<div style='color:Indigo;'>天</div>";
								}else{
									return "状态错误！"
								}
							}
						},
						{name:"timeCount", index:"timeCount", width:100}];
		
		jQuery(grid_selector).jqGrid({
			url : grid_url,
		    shrinkToFit : true,
			colNames : _colnames,
			colModel : _colmodel, 
			jsonReader : {id :"id"},
			pager : pager_selector,
			postData : {sort : "id", order : "desc"}
		});
	}
</script>


	<!-- 配置 grid -->
	<div class="row">
		<div class="col-xs-12 tb-grid">
			<!-- 配置 查询 -->
			@ var _col=[
			@		{name:"ID", index:"id", type:"text"},
			@		{name:"电站编号", index:"number", type:"text"},
			@		{name:"水位类型编号", index:"serialNumber", type:"text"},
			@		{name:"水位类型名称", index:"name", type:"text"},
			@		{name:"创建人", index:"createAc", type:"text"},
			@		{name:"创建时间", index:"createAt", type:"text"},
			@		{name:"是否在用 0在用 1停止", index:"state", type:"text"},
			@		{name:"水位上线预警", index:"upperWarn", type:"text"},
			@		{name:"水位下线预警", index:"lowerWarn", type:"text"},
			@		{name:"水位上线报警", index:"upperAlarm", type:"text"},
			@		{name:"水位下线报警", index:"lowerAlarm", type:"text"},
			@		{name:"水位单位", index:"unitLevel", type:"text"},
			@		{name:"流量预警", index:"flowWarn", type:"text"},
			@		{name:"流量报警", index:"flowAlarm", type:"text"},
			@		{name:"流量单位", index:"unitFlow", type:"text"},
			@		{name:"数据上传方式  0 自动 1手动", index:"status", type:"text"},
			@		{name:"上传数据分类 0全部 1水位 2流量", index:"type", type:"text"},
			@		{name:"开始时间", index:"beginTime", type:"text"},
			@		{name:"结束时间", index:"endTime", type:"text"},
			@		{name:"上传数据时间类型 0秒 1分 2小时 3天", index:"timeType", type:"text"},
			@		{name:"上传时间值", index:"timeCount", type:"text"}							
			@];
			@ include("/common/_function/_search.html",{"col":_col}){}
			<!-- 按钮 -->
			<div class="welljq well-sm" id="btns"></div>
			<!-- grid -->
			<table id="grid-table"></table>
			<!-- 分页-->
			<div id="grid-pager"></div>
		</div>
	</div>
	
	<!-- 引入所需的js -->
	@include("/common/_listscript.html"){}
	
@}	